org.eclipse.vtp.framework.interactions.voice.media
Class VoiceFormatter
java.lang.Object
org.eclipse.vtp.framework.interactions.voice.media.VoiceFormatter
- All Implemented Interfaces:
- IFormatter
- Direct Known Subclasses:
- SimpleEnglishVoiceFormatter
public abstract class VoiceFormatter
- extends java.lang.Object
- implements IFormatter
|
Field Summary |
protected static java.math.BigDecimal |
NEGATIVE_ONE
Convenience member for -1 as a BigDecimal |
protected static java.math.BigDecimal |
ZERO
Convenience member for 0 as a BigDecimal |
|
Method Summary |
protected Content |
getAudioContent(IResourceManager resourceManager,
java.lang.String path,
java.lang.String filename,
java.lang.String defaultText)
Convenience function to locate a requested audio resource given the
expected path and filename. |
java.lang.String |
getDefaultFormatDefintion(FormattableContent formattable,
java.lang.String formatName)
Returns the string representation of the specialization of the given
name and for the given formattable content type. |
java.util.List |
getDefaultFormats(FormattableContent formattable)
Returns the List of Strings containing the
readable names of any built-in specializations available for given
formattable content. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZERO
protected static final java.math.BigDecimal ZERO
- Convenience member for 0 as a BigDecimal
NEGATIVE_ONE
protected static final java.math.BigDecimal NEGATIVE_ONE
- Convenience member for -1 as a BigDecimal
VoiceFormatter
public VoiceFormatter()
getAudioContent
protected Content getAudioContent(IResourceManager resourceManager,
java.lang.String path,
java.lang.String filename,
java.lang.String defaultText)
- Convenience function to locate a requested audio resource given the
expected path and filename. This function attempts the locate the file
using a set of file extensions. If the file is not located, the provided
alternate text is wrapped in a TextContent object and returned.
The file resource is located using the following audio file extension in
descending order:
- Parameters:
resourceManager - Provides access to the available file resources.path - The path to the file. This path is rooted at the voice
project utilizing this language formatter.filename - The name of the file minus the extension.defaultText - The default text to be used if the file is not located.
- Returns:
- Either a AudioContent with the requested audio resource, or the
provided alternate text wrapped in a TextContent object.
getDefaultFormatDefintion
public java.lang.String getDefaultFormatDefintion(FormattableContent formattable,
java.lang.String formatName)
- Description copied from interface:
IFormatter
- Returns the string representation of the specialization of the given
name and for the given formattable content type. This name/definition
mechanism exists to provide facilities for formatters that wish to allow
user defined formats.
For example, a formatter may allow the user to specify how they want the
content to be formatted using a mark up language similar to the printf
family of functions in C and Java.
- Specified by:
getDefaultFormatDefintion in interface IFormatter
- Parameters:
formattable - The type of content to retrieve the definition for.formatName - The name of the definition.
- Returns:
- The format definition.
getDefaultFormats
public java.util.List getDefaultFormats(FormattableContent formattable)
- Description copied from interface:
IFormatter
- Returns the
List of Strings containing the
readable names of any built-in specializations available for given
formattable content. Not all formattable content will have built-in
specializations.
A phone number would be a good example of a specialization that could be
created for the DigitsContent type of content. There are
some common rules around how a phone number is read back in contrast to
just a string of numbers.
- Specified by:
getDefaultFormats in interface IFormatter
- Parameters:
formattable - The type of content to find specializations for.
- Returns:
- A list of strings or an empty list if no specializations are
available.